<template>
  <div>
    <div style="margin-top: 10px">
      <div v-for="(item, index) in noticeList" style="margin-left: 150px; ">
        <div style="width: 44%; height: 100px; float: left; margin-bottom: 24px;
          background-color: #63B8FF; margin-right: 14px; border-radius: 10px; color: #fff">
          <img :src="baseApi + '/car/' + item.img" style="width: 160px; height: 100px; border-radius: 10px">
          <div style="margin-left: 170px; margin-top: -90px">{{item.name}} {{item.description}}</div>
        </div>

      </div>
    </div>

  </div>
</template>

<script>
  import { getNoticeList } from '@/api/ceamNotice'
  import { add } from '@/api/ceamStar'
  import { mapGetters } from 'vuex'

  export default {
    name: 'FrontFood',
    data() {
      return {
        noticeList: [],
        visible: false,
        form: {}
      }
    },
    computed: {
      ...mapGetters([
        'baseApi'
      ])
    },
    created() {
      this.listNotice();
    },

    methods: {
      listNotice() {
        console.log('获取')
        const params = {
          page: 0,
          size: 100,
        }
        getNoticeList(params).then(res => {
          this.noticeList = res.records;
        })
      },
      showAdd() {
        this.visible = true;
      },
      cancelCU() {
        this.visible = false;
      },
      submitCU() {
        add(this.form).then(res => {
          this.visible = false;
          this.$message({
            message: '添加成功',
            type: 'success'
          })
        }).catch(error => {
          this.$message({
            message: '添加失败',
            type: 'waring'
          })
        })
      }
    }
  }
</script>

<style scoped>

</style>
